UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IM7J7Trc99U8cDEGmCcmZezNbTdp4ugDpcQtR+4pQ+w=' 
WHERE 
  key_id = '7253570377f98cd3c6fa6805c2489c9b22ea1b27cd0a406d5d508bb8b0cc54f4' 
  AND (
    token = 'IM7J7Trc99U8cDEGmCcmZezNbTdp4ugDpcQtR+4pQ+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061