UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gF5TKifYnrIzOxD09tdhCUGc1WDLwodmq/6X4hxLd5k=' 
WHERE 
  key_id = '8365a52c0884edfc73e5af1e079ff7331e29cb41f9df801c612f840c8dd7feae' 
  AND (
    token = 'gF5TKifYnrIzOxD09tdhCUGc1WDLwodmq/6X4hxLd5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032