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

Query time 0.00031