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

Query time 0.00040