UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wiIBjmv9T/ww9JceYr6daY0hSxHn87JMuxC8Q8bySdA='
WHERE
key_id = 'dea6c8270e06d95f5191012bbd3f1aaf94cdf44112446a05e93192724e47ea2f'
AND (
token = 'wiIBjmv9T/ww9JceYr6daY0hSxHn87JMuxC8Q8bySdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)