UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fsZrSLGXhx5P/v+U3mmLObJT66vROfhEGMrnyBoRd1w='
WHERE
key_id = '6d41d4aa8c1f1992f713868db7c2afb29482de0d4a9c44c4d0ad94963684627d'
AND (
token = 'fsZrSLGXhx5P/v+U3mmLObJT66vROfhEGMrnyBoRd1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)