UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ioECIZauJ4VVRnpqw02i11VzJXn7YyNSa4SSbITz36I='
WHERE
key_id = '1f9044df584edb337f047904b3f5877955ce8a2f73af88701910a2355eb5cae4'
AND (
token = 'ioECIZauJ4VVRnpqw02i11VzJXn7YyNSa4SSbITz36I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)