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

Query time 0.00030