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