UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dBSxOb9zaAHj81cMWl4MS431/8t0BZ4BA9wBgtoBYVI='
WHERE
key_id = 'c253ada94b67f2178deb2fb03c7944574d41cf2db41eb445e3735ab44187b645'
AND (
token = 'dBSxOb9zaAHj81cMWl4MS431/8t0BZ4BA9wBgtoBYVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)