UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W+9tmHo6pNddQHR9JHCSLqamD6RD8GEs3WqXsEHCrTI=' 
WHERE 
  key_id = '7cbc6de2f24acd16a18ff8c4fd8cf97500cbbdb5730fb48845695af5a4db7e59' 
  AND (
    token = 'W+9tmHo6pNddQHR9JHCSLqamD6RD8GEs3WqXsEHCrTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025