UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BZhWErSSbTmLpnEeoD9l1m8ku+Q/SnA71+20W+uEajc='
WHERE
key_id = '3f0f2eb4d121d9b55e85082139a55a9691420c358f50023e632bcec216726823'
AND (
token = 'BZhWErSSbTmLpnEeoD9l1m8ku+Q/SnA71+20W+uEajc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)