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