UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RgUybx5+OdltA3xUgF0N66X4WhyZOpsMPVr4kpAE1R4='
WHERE
key_id = 'cf3897f26310bd97017b112d90e971361cfdd5ce5358ea658b2ab43b2ebe41e7'
AND (
token = 'RgUybx5+OdltA3xUgF0N66X4WhyZOpsMPVr4kpAE1R4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)