UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6XZFt3Wg7g40YaD5fhSRFFbe53iYBW3cUdYRTMCFROQ='
WHERE
key_id = 'fdb71eee56089756d9cd611999cbbf03ab9929723e2ae56c12c17d10dc71c1dc'
AND (
token = '6XZFt3Wg7g40YaD5fhSRFFbe53iYBW3cUdYRTMCFROQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)