UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'keDQQcQ61lQV/yfoxScqqpHDQJ7/21HPblj5ef2aNFg='
WHERE
key_id = '47dae3f7c92102d29aa48091ba0ae6caa2a354d32abc5568ae99c529a229f245'
AND (
token = 'keDQQcQ61lQV/yfoxScqqpHDQJ7/21HPblj5ef2aNFg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)