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