UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cK7GbuXQAD1SLe5iLLbFY0bJ66g0Y3qg2UqwoqQ5Efw='
WHERE
key_id = '283fbb9423d678314a3fea7d78b0290d0ccb522cfda529a7c2a16fa33e5f3592'
AND (
token = 'cK7GbuXQAD1SLe5iLLbFY0bJ66g0Y3qg2UqwoqQ5Efw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)