UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jEqYJJMnecyy/vROKIXctCizMeWi71Nqzs74Fkfvyqs=' 
WHERE 
  key_id = '9f24881add61005e9ad63606c53ddffb07ae3463b0c494577a8b997bad509508' 
  AND (
    token = 'jEqYJJMnecyy/vROKIXctCizMeWi71Nqzs74Fkfvyqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026