UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RqUkdA6r60luqV47Dtakppf9BFfUx7nQjaIJPE9LhA8='
WHERE
key_id = 'aea4d400ff8d62e2b625023ff780b3733ed6ed8d50620f077df1e2c97dbc9a81'
AND (
token = 'RqUkdA6r60luqV47Dtakppf9BFfUx7nQjaIJPE9LhA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)