UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gj5bwi6PnK9SXC72w0oiDe79wVcaYpdvar/DteIQC94='
WHERE
key_id = '160e8a59083a007506b5ba1c9cfbc34d3bf87afcbb447773e0972509503b0add'
AND (
token = 'gj5bwi6PnK9SXC72w0oiDe79wVcaYpdvar/DteIQC94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)