UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Czo5Bok2XOSSskdXNN8QvICgfNISPcaPR8AtBem61E0=' 
WHERE 
  key_id = 'e5bae0f909c45f0a242288270f0749c3b247647f8a0de33d6933f3a89f20a415' 
  AND (
    token = 'Czo5Bok2XOSSskdXNN8QvICgfNISPcaPR8AtBem61E0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018