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

Query time 0.00040