UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RnheCHWWD8ItGaQSCy/2v2JqFdqOTyrdepgCvz2yBmY=' 
WHERE 
  key_id = 'd7936950b2dd3c00f1778feb9ad5001fd0bcd63970a4adbdba921c0208cbb738' 
  AND (
    token = 'RnheCHWWD8ItGaQSCy/2v2JqFdqOTyrdepgCvz2yBmY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035