UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nHtz6iKAJlUGxPMn/8ZFjL3uG3YxSTkj4J1IG15YwJk='
WHERE
key_id = 'b5312c82cbe75e5e17c51b1c95bb1b8b0bf09f5b6a8565e757c55753cf218f60'
AND (
token = 'nHtz6iKAJlUGxPMn/8ZFjL3uG3YxSTkj4J1IG15YwJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)