UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '22ERY3dfeLeyC0YzO9U+s0b1RBDWGuSpQtFZzyIxCoE='
WHERE
key_id = 'aa5f21ef86361b44a69a7b9138249a340d5634e957cc18011299e23f96b402e9'
AND (
token = '22ERY3dfeLeyC0YzO9U+s0b1RBDWGuSpQtFZzyIxCoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)