UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ksLXjZRxokgf3sphLxxSIqywO+MwTD5xRglSAN4mGng=' 
WHERE 
  key_id = 'f2b2a986e0296f19310435635e24cbd575d9a66652ac1b20cadcdb5a5b88df99' 
  AND (
    token = 'ksLXjZRxokgf3sphLxxSIqywO+MwTD5xRglSAN4mGng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023