UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gBYQpa+mthvXosg0oEPKhkqWoZp5s6OICmvrHEdSQ+I='
WHERE
key_id = '04fc54bd1f6b890d79441fa6b4e4ac0d709f85044eed29d6bd59c16d6d737409'
AND (
token = 'gBYQpa+mthvXosg0oEPKhkqWoZp5s6OICmvrHEdSQ+I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)