UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MSl1GmptIzg5eHssxehTeeESeC+oWgq/CPfV1tq3A18=' 
WHERE 
  key_id = '3f936f3cf3ec74be055979c75722357fece444626bcdc53a876a05865e0c531d' 
  AND (
    token = 'MSl1GmptIzg5eHssxehTeeESeC+oWgq/CPfV1tq3A18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051