UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5lRqFJUk4c4VD+FFvLNlZwiCNtyvHefmx6DFU8nzzhw='
WHERE
key_id = '1ed2943c06cf681066f6262439db44b792e5744078fa74ee1090fc67f7b2f8f8'
AND (
token = '5lRqFJUk4c4VD+FFvLNlZwiCNtyvHefmx6DFU8nzzhw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)