UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wUkIjWwpBhBbcUSS/kzIJb3j4jLgxJerPOG20MtjI7Y='
WHERE
key_id = '17c5f47e687f1dec015712b5c9f8e2a7656eda1eba3c91548b546f9512e9f500'
AND (
token = 'wUkIjWwpBhBbcUSS/kzIJb3j4jLgxJerPOG20MtjI7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)