UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9irS6MtM7tb9CjGoVMhqeya7ZAi6tlRfjAZbMj3mKDw='
WHERE
key_id = 'e2723532645ceba8636c319f0b35f1eb4e480b528c46cfdfcaac1c53b490f9a0'
AND (
token = '9irS6MtM7tb9CjGoVMhqeya7ZAi6tlRfjAZbMj3mKDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)