UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tpLZwE8TdqVJk79PfLsvJIQ+8y7Sk30ZI1gUBeynI9c='
WHERE
key_id = 'e10565ffca6613c25216b27c19af0c7bdf860e2b91d1d3c4720522f2cb4906f6'
AND (
token = 'tpLZwE8TdqVJk79PfLsvJIQ+8y7Sk30ZI1gUBeynI9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)