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

Query time 0.00021