UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CE91S6U0SWQa44cwIme+TR8QAedn9vsUVb/Ax7M0RaQ=' 
WHERE 
  key_id = '3994a0bb702124bc89c4911a0c8bb0c1fc8634b19ed6be00772be5d2bbf7b55b' 
  AND (
    token = 'CE91S6U0SWQa44cwIme+TR8QAedn9vsUVb/Ax7M0RaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020