UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EgT30b/eswQH4HF14oACrXZ4vHUCfDkGNOpE8GyC68E='
WHERE
key_id = '3a831e9fe21421e5c822593a56d5b2d795136c83160c3f93f4e13fb632352e56'
AND (
token = 'EgT30b/eswQH4HF14oACrXZ4vHUCfDkGNOpE8GyC68E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)