UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pZT8ULVeqwQgeaFzViT3rChTujU5ghqbcSfsI1mENhI='
WHERE
key_id = 'a1ea98cb26bcdf989893aa8df50bd050e1cea63655a6cbe484266156614a36cf'
AND (
token = 'pZT8ULVeqwQgeaFzViT3rChTujU5ghqbcSfsI1mENhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)