UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7cvaNF/um2onLbN/EOqUcG+PGPDjDAztdLGwJ6VIsDk='
WHERE
key_id = 'c8d30cb5c708c6979a7ec2c5dfbd50788f95edceb2bda3671341630e62cc2f8a'
AND (
token = '7cvaNF/um2onLbN/EOqUcG+PGPDjDAztdLGwJ6VIsDk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)