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