UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tdbFt19q790cB0vZoPFg4dc7kNJcTLfdzGtPJji7bFA='
WHERE
key_id = 'ab452de642dd77cf94e398d2bbcc04cd3130768fa21022573a5f065a5fc7476c'
AND (
token = 'tdbFt19q790cB0vZoPFg4dc7kNJcTLfdzGtPJji7bFA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)