UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GDNiKS13eljs+uGePPItu8sJr8A3AGA+scv0V+H13Sw=' 
WHERE 
  key_id = '5359ac19614c07b3f449c2bf19268a9d84490e72d96db190a94f7a1462dbc8b1' 
  AND (
    token = 'GDNiKS13eljs+uGePPItu8sJr8A3AGA+scv0V+H13Sw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043