UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZ45GgbstdnWswNqsZ288IHXTq0xsllvtWiQ3ipzJAw=' 
WHERE 
  key_id = '50e575d098aa1553251f9c41e4c1afbf3ef8333e46400a96c042417b00cb5c6c' 
  AND (
    token = 'XZ45GgbstdnWswNqsZ288IHXTq0xsllvtWiQ3ipzJAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027