UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7eJZfjAfXLVUB+qlQVDnc7rn+ymj9ZCIyqbIg6w0294='
WHERE
key_id = '99e1471642bc6d6285adf2919428e4b6c2f5b63eda29c5512055127f382a7b05'
AND (
token = '7eJZfjAfXLVUB+qlQVDnc7rn+ymj9ZCIyqbIg6w0294='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)