UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQoZHCUH+Lpa2aSUk3rPYdz2PxtzZu7drv1Moe3ReA8=' 
WHERE 
  key_id = '5070bec5cb0751c81a370c47580a351536f044c78f29b1376f1e81f2e3b38d62' 
  AND (
    token = 'KQoZHCUH+Lpa2aSUk3rPYdz2PxtzZu7drv1Moe3ReA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033